Skip to content

feat: async dynamic import() API (v0.18 P1) - #778

Merged
buke merged 2 commits into
mainfrom
feat/v018-dynamic-import
Nov 6, 2026
Merged

buke merged 2 commits into
mainfrom
feat/v018-dynamic-import

Conversation

@buke

@buke buke commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add Go DynamicImportHandler, SetDynamicImportHandler, FinishDynamicImport, and LoadModuleURL for quickjs-ng v0.18 async import().
  • Add opt-in SetDefaultDynamicImport (qjs-compatible C stub); keep SetModuleImport loader-only so ModuleBuilder virtual modules keep working on the legacy sync path.
  • Cover sync, error, deferred (Schedule + Go Await), and fail-closed paths.

Test plan

  • go test ./...
  • Dynamic import sync/error/deferred/fail-closed tests
  • Existing ModuleBuilder / SetModuleImport tests

Expose SetDynamicImportHandler/FinishDynamicImport/LoadModuleURL and an
opt-in SetDefaultDynamicImport stub, without changing SetModuleImport's
legacy sync import() behavior used by ModuleBuilder.
@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (01a7dca) to head (c7a8e24).

Additional details and impacted files
@@            Coverage Diff             @@
##              main      #778    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           17        18     +1     
  Lines         3262      3421   +159     
==========================================
+ Hits          3262      3421   +159     
Files with missing lines Coverage Δ
callback_dispatch.go 100.00% <100.00%> (ø)
context.go 100.00% <100.00%> (ø)
dynamic_import_test_helpers.go 100.00% <100.00%> (ø)
runtime.go 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 01a7dca...c7a8e24. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Exercise goDynamicImport edge cases, FinishDynamicImport error/success
hooks, LoadModuleURL attribute checks, and fail-closed pending cleanup.
@buke
buke merged commit ab2dbcb into main Nov 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant